unit ClassTJ3PlaceMark;

interface

uses SysUtils, ClassTJ3BaseTAG;

type
    TJ3KmlCoordinate = class(TJ3KmlBaseTAG)
    private
      FX: real;
      FY: real;
      FZ: real;
    protected
      function GetTAG:string; override;
    public
      function GetLines: String; override;
      property X : real read FX write FX;
      property Y : real read FY write FY;
      property Z : real read FZ write FZ;
  end;

    TJ3KmlPoint = class(TJ3KmlBaseTAG)
    private
      FCoordinates: TJ3KmlCoordinate;
    protected
      function GetTAG:string; override;
    public
      function GetLines: String; override;
      property Coordinates : TJ3KmlCoordinate read FCoordinates write FCoordinates;
  end;

  TJ3KmlLookAt = class(TJ3KmlBaseTAG)
    private
      FLongitude:real;
      FLatitude:real;
      FAltitude:Integer;
      FHeading: real;
      FTilt: Integer;
      FRange: Real;
    protected
      function GetTAG:string; override;
    public
      function GetLines: String; override;
      property Longitude : Real read FLongitude write FLongitude;
      property Latitude : Real read FLatitude write FLatitude;
      property Altitude : Real read FAltitude write FAltitude;
      property Heading : Real read FHeading write FHeading;
      property Tilt : Real read FTilt write FTilt;
      property Range : Real read FRange write FRange;
  end;

  TJ3KmlPlaceMark = class(TJ3KmlBaseTAG)
    private
      FNome:String;
    protected
      function GetTAG:string; override;
    public
      constructor Create; Overload;
      constructor Create(const _nome:string); overload;
      function GetLines: String; override;
      property Nome : string read FNome write FNome;
  end;


implementation

{ TJ3KmlPlaceMark }

constructor TJ3KmlPlaceMark.Create;
begin
  FNome := 'PlaceMark';
end;

constructor TJ3KmlPlaceMark.Create(const _nome: string);
begin
  inherited Create;
  FNome := _nome;
end;

function TJ3KmlPlaceMark.GetLines: String;
begin
  Linhas.Clear;
  Linhas.Add(GetIniTAG);
  Linhas.Add(GetFimTAG);
end;

function TJ3KmlPlaceMark.GetTAG: string;
begin
  Result := 'PlaceMaker';
end;

{ TJ3KmlCoordinate }

function TJ3KmlCoordinate.GetLines: String;
var
 strX, strY, strZ : String;
begin
  Linhas.Add(GetIniTAG);
  strX := FormatFloat('0',X);
  strY := FormatFloat('0',Y);
  strZ := FormatFloat('0',Z);

  Linhas.Add('<' + StrX + ', ' + StrY + ', ' + StrZ + '>');
  Linhas.Add(GetFimTAG);

  Result := Linhas.Text;
end;

function TJ3KmlCoordinate.GetTAG: string;
begin
  Result := 'Coordinate';
end;

{ TJ3KmlPoint }

function TJ3KmlPoint.GetLines: String;
begin
  Linhas.Add(GetIniTAG);
  Linhas.Add('');
  Linhas.Add(GetFimTAG);
  Result := Linhas.Text;
end;

function TJ3KmlPoint.GetTAG: string;
begin
  Result := 'point';
end;

{ TJ3KmlLookAt }

function TJ3KmlLookAt.GetLines: String;
begin
  Linhas.Add(GetIniTAG);
  Linhas.Add('<longitude>' + '</longitude>');
  Linhas.Add('<latitude>' + '</latitude>');
  Linhas.Add('<altitude>' + '</altitude>');
  Linhas.Add('<heading>' + '</heading>');
  Linhas.Add('<tilt>' + '</tilt>');
  Linhas.Add('<range>' + '</range>');
  Linhas.Add('<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>');
  Linhas.Add(GetFimTAG);
  Result := Linhas.Text;
end;

function TJ3KmlLookAt.GetTAG: string;
begin
  Result := 'LookAt';
end;

end.
